package com.chh.pdapp.prize.command;


import com.chh.pdapp.assembler.PrizeAssembler;
import com.chh.pdclient.dto.PrizeAddCmd;
import com.chh.pdclient.dto.data.PrizeVO;
import com.chh.pddomain.gateway.PrizeGateway;
import com.chh.pddomain.prize.PrizeEntity;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Component
@AllArgsConstructor
public class PrizeAddCmdExe {

    private final PrizeGateway prizeGateway;

    public PrizeVO execute(PrizeAddCmd cmd) {
        PrizeEntity prizeEntity = prizeGateway.save(PrizeAssembler.toAddEntity(cmd));

        return PrizeAssembler.toPrizeVO(prizeEntity);
    }
}
